
$(document).ready(function(){
	var props = new Object();
		props.wrapperClassName 	= "rs_accordion_wrapper";
		props.tabClassName 		= "rs_accordion_tab";
		props.contentClassName 	= "rs_accordion_content";
		//
	var accordion = $("#example").RSAccordion(props); 
	var secondItem = accordion.getItemByIndex(1);
	var tiltle = $(secondItem).find("a").html();
	// alert("The title of the second tab is: " + tiltle);
top.addItem = function (){
	accordion.addItem('<div><div class="tabLabelAction">Item '+ Math.ceil(Math.random()*1000)  +' </div><div class="openAction option">toggle</div></div>', '<div>New item ' + new Date()+'</div>');
}

top.drawItems = function (){
	var ulString = ''+
  	'<ul id="example"">';
  	var limit = Math.ceil(Math.random()*10);
  	for(var i=0; i<limit; i++){
		ulString += '<li>'+
			'<div><div class="tabLabelAction">Test ['+ i +'] '+Math.ceil(Math.random()*1000)+' </div><div class="openAction option">toggle</div></div>'+
			'<div>'+ i +' content</div>'+
		'</li>';
  	}
	ulString += '</ul>';
	accordion.draw(ulString);
}
});

